package com.klbnt.datashare.controller;


import com.klbnt.datashare.entity.ResponseData;
import com.klbnt.datashare.service.GraphService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wkm
 * @since 2022-12-27
 */
@RestController
public class GraphController {

    @Autowired
    private GraphService graphService;

    @GetMapping("/graph")
    ResponseData getGraph() {
        return graphService.getData(0);
    }

    @GetMapping("/graph/{time}")
    ResponseData getGraphByTime(@PathVariable String time) {
        return graphService.getData(Integer.parseInt(time));
    }

}
